#ifndef __local_resource_h__
#define __local_resource_h__

#include <stdio.h>

#include "win/file.h"
#include "win/image.h"
#include "win/cache.h"

#include <atlstr.h>
#include <map>
#include <gdiplus.h>
#pragma comment(lib, "gdiplus.lib")

namespace win
{
    class LocalCache : public Cache
    {
    public:
        LocalCache();
        ~LocalCache();

    public:
        BOOL    GetBinaryResource( LPCTSTR lpszFile, BYTE ** pBuffer, DWORD *dwSize, BOOL bCache );
        BOOL    GetImage( LPCTSTR lpszFile, Image* winImage, BOOL bCache );

    public:
        CString GetWorkspace()                              { return m_strWorkspace; }

    private:
        void Initialize();

    private:
        Gdiplus::GdiplusStartupInput m_gdiplusStartupInput;
        ULONG_PTR m_pGdiToken;

        CString m_strWorkspace;

        typedef std::map<CString, Image *> _imgcache;
        _imgcache m_mapCache;
    };
}

#endif